Passed
Push — master ( 203c84...bd5512 )
by Paul
04:35
created

GLSR.onChangeStatus   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 3
nc 2
nop 1
dl 0
loc 21
rs 9.3142
c 2
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A GLSR.postAjax 0 6 2
A GLSR.postAjax 0 18 2
1
GLSR.colorControls = function()
0 ignored issues
show
Bug introduced by
The variable GLSR seems to be never declared. If this is a global, consider adding a /** global: GLSR */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
2
{
3
	if( typeof x.wp !== 'object' || typeof x.wp.wpColorPicker !== 'function' )return;
0 ignored issues
show
Bug introduced by
The variable x seems to be never declared. If this is a global, consider adding a /** global: x */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
4
	x( document ).find( 'input[type="text"].color-picker-hex' ).each( function() {
5
		x( this ).wpColorPicker( x( this ).data( 'colorpicker' ) || {} );
6
	});
7
};
8
9
GLSR.insertNotices = function( notices )
0 ignored issues
show
Bug introduced by
The variable GLSR seems to be never declared. If this is a global, consider adding a /** global: GLSR */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
10
{
11
	if( !notices )return;
12
	if( !x( '#glsr-notices' ).length ) {
13
		x( '#message.notice' ).remove();
14
		x( 'form#post' ).before( '<div id="glsr-notices" />' );
15
	}
16
	x( '#glsr-notices' ).html( notices );
17
	x( document ).trigger( 'wp-updates-notice-added' );
18
};
19
20
GLSR.onClearLog = function( ev )
0 ignored issues
show
Bug introduced by
The variable GLSR seems to be never declared. If this is a global, consider adding a /** global: GLSR */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
21
{
22
	var request = {
23
		action: 'clear-log',
24
	};
25
	GLSR.postAjax( ev, request, function( response ) {
0 ignored issues
show
Bug introduced by
The variable GLSR seems to be never declared. If this is a global, consider adding a /** global: GLSR */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
26
		GLSR.insertNotices( response.notices );
0 ignored issues
show
Bug introduced by
The variable GLSR seems to be never declared. If this is a global, consider adding a /** global: GLSR */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
27
		x( '#log-file' ).val( response.logger );
28
	});
29
};
30
31
GLSR.pointers = function( pointer )
32
{
33
	x( pointer.target ).pointer({
34
		content: pointer.options.content,
35
		position: pointer.options.position,
36
		close: function() {
37
			x.post( ajaxurl, {
0 ignored issues
show
Bug introduced by
The variable ajaxurl seems to be never declared. If this is a global, consider adding a /** global: ajaxurl */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Bug introduced by
The variable x seems to be never declared. If this is a global, consider adding a /** global: x */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
38
				pointer: pointer.id,
39
				action: 'dismiss-wp-pointer',
40
			});
41
		},
42
	})
43
	.pointer( 'open' )
44
	.pointer( 'sendToTop' );
45
	x( document ).on( 'wp-window-resized', function() {
46
		x( pointer.target ).pointer( 'reposition' );
47
	});
48
};
49
50
GLSR.postAjax = function( ev, request, callback )
0 ignored issues
show
Bug introduced by
The variable GLSR seems to be never declared. If this is a global, consider adding a /** global: GLSR */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
51
{
52
	ev.preventDefault();
53
	var el = x( ev.target );
54
	if( el.is( ':disabled' ))return;
55
	request.nonce = request.nonce || el.closest( 'form' ).find( '#_wpnonce' ).val();
56
	var data = {
57
		action: site_reviews.action,
0 ignored issues
show
Bug introduced by
The variable site_reviews seems to be never declared. If this is a global, consider adding a /** global: site_reviews */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
58
		request: request,
59
	};
60
	el.prop( 'disabled', true );
61
	x.post( site_reviews.ajaxurl, data, function( response ) {
0 ignored issues
show
Bug introduced by
The variable x seems to be never declared. If this is a global, consider adding a /** global: x */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
62
		if( typeof callback === 'function' ) {
63
			callback( response );
64
		}
65
		el.prop( 'disabled', false );
66
	});
67
};
68
69
GLSR.textareaResize = function( el )
0 ignored issues
show
Bug introduced by
The variable GLSR seems to be never declared. If this is a global, consider adding a /** global: GLSR */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
70
{
71
	var minHeight = 320;
72
	var textarea = el[0];
73
	textarea.style.height = 'auto';
74
	textarea.style.height = textarea.scrollHeight > minHeight ? textarea.scrollHeight + 'px' : minHeight + 'px';
75
};
76